package com.es.hr.shopscore;

import javax.servlet.http.HttpServletRequest;

import com.es.hr.shop.ShopBiz;
import com.es.main.LoginUserBeen;
import com.es.util.common.CommonBiz;
import com.es.util.page.PageBean;
import com.es.util.page.PageNavigator;
import com.opensymphony.webwork.interceptor.ServletRequestAware;
import com.opensymphony.xwork.ActionSupport;

public class QueryShopListPopForScoreAction extends ActionSupport implements ServletRequestAware{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	HttpServletRequest request;
	 
	   public String execute()throws Exception
	   {
		   String curpage = request.getParameter("curpage")==null?"1":request.getParameter("curpage");
		   String emp_city_code = request.getParameter("emp_city_code")==null?"":request.getParameter("emp_city_code");
		   String emp_province_code = request.getParameter("emp_province_code")==null?"":request.getParameter("emp_province_code");
		   String emp_area_code = request.getParameter("emp_area_code")==null?"":request.getParameter("emp_area_code");
		   String queryShopCode = request.getParameter("queryShopCode")==null?"":request.getParameter("queryShopCode");
		   String queryShopName = request.getParameter("queryShopName")==null?"":request.getParameter("queryShopName");
		   
		   CommonBiz biz = new CommonBiz((LoginUserBeen)request.getSession(false).getAttribute("loginuser"));
		   ShopBiz manegeBiz = new ShopBiz();

		   request.setAttribute("areaList", biz.getAreaList());
		   request.setAttribute("provinceList", biz.getProvinceList(emp_area_code));
		   request.setAttribute("cityList", biz.getCityList(emp_province_code));
		   
		   PageNavigator pageNav = new PageNavigator();
		  
		   PageBean pageBean  = manegeBiz.searchShop(emp_area_code, emp_province_code, emp_city_code, queryShopCode, queryShopName, Integer.parseInt(curpage));
		   request.setAttribute("pageBean", pageBean);
		   request.setAttribute("emp_city_code", emp_city_code);
		   request.setAttribute("emp_province_code", emp_province_code);
		   request.setAttribute("emp_area_code", emp_area_code);
		   request.setAttribute("queryShopCode", queryShopCode);
		   request.setAttribute("queryShopName", queryShopName);
		   return "success";
	   }
	
	   public void setServletRequest(HttpServletRequest request) {
		     this.request = request;
		   }
}